package com.atguigu.gulimall.member.web;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;

/**
 * @Author 小坏
 * @Date 2021/2/24 14:25
 * @Version 1.0
 * @program: 父工程 gulimall 万物起源之地
 */

@Controller
public class MemberWebController {
    @Autowired
    OrderFeignService orderFeignService;

    /**
     * 支付完成回调页面
     *
     * @return
     */
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, Model model) {
        HashMap<String, Object> page = new HashMap<> ();
        page.put ("page", pageNum.toString ());
        //查询当前登录用户的所有订单
        R r = orderFeignService.listWithItem (page);
        model.addAttribute ("orders", r);
        return "orderList";
    }

}
